<template>
  <div>
    <el-table :data="paperRecordList" tooltip-effect="dark" style="width: 100%">
      <el-table-column label="编号" prop="id" width="140"> </el-table-column>
      <el-table-column prop="pname" label="试卷名称" width="230">
      </el-table-column>
      <el-table-column prop="subTime" label="考试时间" width="230">
      </el-table-column>
      <el-table-column prop="score" label="分数" width="200"> </el-table-column>
      <el-table-column prop="subject.sname" label="学科" width="210">
      </el-table-column>
      <el-table-column prop="stage.stname" label="阶段" width="210">
      </el-table-column>
    </el-table>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
      :page-sizes="[5, 10, 15, 20]" :page-size="pageNum" layout="total, sizes, prev, pager, next, jumper" :total="total"
      style="margin-left: 300px">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "PaperRecordList",
  data() {
    return {
      paperRecordList: [],
      id: 0,
      dname: null,
      score: "",
      currentPage: 1,
      pageNum: 5,
      total: 0,
      userInfo: {},
    };
  },
  methods: {
    handleSizeChange(val) {
      this.pageNum = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getList();
    },
    getList() {
      this.axiosJSON
        .get(
          "/paper/getAll?currentPage=" +
          this.currentPage +
          "&pageNum=" +
          this.pageNum +
          "&userId=" +
          this.$store.getters.getLoginUser.id
        )
        .then((result) => {
          this.paperRecordList = result.data.list;
          this.total = result.data.total;
        });
    },
  },
  mounted() {
    this.$parent.questionTitle = "考试记录";
    this.$parent.id = 0;
    this.oaevent.$on("updatePaperRecordList", () => {
      this.getList();
    });
    this.getList();
  },
};
</script>

<style>
</style>
